<?php
namespace app\admin\controller;
use app\admin\model\Printer as thisModel;
use think\Db;
use Env;
use PHPExcel_IOFactory;
class Printer extends Common
{
    function index(){
        $thisModel = new thisModel();
        if( request()->isAjax() ){
            $data = $thisModel->disposeData(input('post.'));
            $data['createtime'] = time();
            $data['admin_id'] = session('admin_id');
            $res = Db::name('print_log')->insertGetId($data);
            if ($res) {
                $data = array(
                    'createtime'    => date("Y-m-d H:i:s")
                    );
                exitjson(1, '保存成功',$data);
            } else {
                exitjson(0, '保存失败');
            }
        }
        return $this->fetch('index');
    }

    function print_log(){
        $thisModel = new thisModel();
        $mainData = $thisModel->mainData();
        $inputData = input('get.');

     // dump($mainData);exit;
        $this->assign('list',$mainData['list']);
        $this->assign('page',$mainData['page']);
        $this->assign('count',$mainData['count']);
        $this->assign('inputData',$inputData);

        return $this->fetch('print_log');
    }

    function mainDel(){
        $id = input('id');
        if($id>0){
            $thisModel = new thisModel();
            $one = $thisModel->get($id);
            $res = $one->delete();
            if($res !== false){
                exitjson(1,'删除成功');
            }else{
                exitjson(0,'删除失败');
            }
        }
    }
















}